"""
复合组合
"""
import numpy as np

data= [('zs',[100,100,100],18),
       ('ls',[90,90,90],19),
       ('ww',[80,80,80],20)]
# 第一种，通过字符串的方式指定dtype
# ary = np.array(data,dtype='U2,3int32,int32')
# print(ary)
# print(ary['f2'].mean())

# 第二种，通过列表套元组
# ary = np.array(data,dtype=[('name','str',2),('score','int32',3),('age','int32',1)])
# print(ary['age'])
# print(ary['score'])

# 第三种，通过字典的固定键设置dtype
ary = np.array(data,dtype={'names':['name','score','age'],'formats':['U2','3int32','int32']})
print(ary['name'])
